using System;
using CStock;
using CUtil;
using System.Diagnostics;
using System.ComponentModel;


namespace CStock
{


    public class News : StockObjectBase, INews
    {


        protected DateTime date;
        protected string assetID;
        protected double yieldChange;
        protected double earningChange;
        protected string newsText;



        public News()
        {
            this.path = "C:\\tmp";
            //ResetPathFromConfiguration();
        }
        private string SetID()
        {
            iD = "Unknown";
            if (this.date != null && this.assetID != null && this.assetID != string.Empty)
            {
                this.iD = string.Format("{0}_{1:yyyyMMdd}", this.assetID, this.date);
            }

            return iD;

        }
        public override string ID
        {
            get
            {
                return this.iD;

            }
            set
            {
                this.iD = value;
            }
        }

        #region INews Members

        public DateTime Date
        {
            get
            {
                return this.date;
            }
            set
            {
                date = value;
                SetID();
            }
        }

        public string AssetID
        {
            get
            {
                return this.assetID;
            }
            set
            {
                assetID = value;
                SetID();
            }
        }

        public double YieldChange
        {
            get
            {
                return this.yieldChange;
            }
            set
            {
                yieldChange = value;
            }
        }

        public double EarningChange
        {
            get
            {
                return this.earningChange;
            }
            set
            {
                earningChange = value;
            }
        }
        public string NewsText
        {
            get
            {
                return this.newsText;
            }
            set
            {
                newsText = value;
            }
        }

        #endregion
    }
}
